package testJdk.anno.older;

import testJdk.anno.newer.ConstructorAnnotation;

/**
 * @author keyer
 * @Description : 测试注解的类
 * Created by cyd on 2021-04-29 14:10:21
 */
@AuthorAnnotation(name = "cyd", company = "keyer")
public class Person {
    @CommonAnnotation(type = String.class, description = "姓名")
    private String name;
    @CommonAnnotation(type = Integer.class, description = "年龄")
    private Integer age;

    @ConstructorAnnotation
    public Person() {
        this("unknown", 0);
    }

    @ConstructorAnnotation(value = "带参数的构造")
    public Person(@CommonAnnotation(type = String.class, description = "姓名") String name,
                  @CommonAnnotation(type = Integer.class, description = "姓名") int age) {
        this.name = name;
        this.age = age;
    }

    @CommonAnnotation(type = String.class,description = "获得名字")
    public String getName() {
        return this.name;
    }

    @CommonAnnotation(type = Integer.class,description = "获得年龄")
    public Integer getAge() {
        return this.age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
